<template>
	<view>
		<!-- 预算内调整 -->
		<view class="head_tb">
			<u-tabs :activeStyle="{
						 fontSize:'30rpx',
						 color: '#007aff'
			         }" :inactiveStyle="{
						 fontSize:'30rpx'
			         }" :scrollable='false' :lineWidth='40' itemStyle='height:80rpx;padding:0 10rpx' :list="list1"
				@click="checkbtn"></u-tabs>
		</view>
		
		<!-- 基本信息 -->
		<view class="msp">
			<CellChild :addlist='addlist' title='基本信息' :fileNo = 'fileNo' :rows='rows' id='add_one'>
			</CellChild>
		</view>
		<!-- 调出预算 -->
		<view class="formcard" id="add_two">
			<view class="bodtitle">
				<p><b>调出预算</b></p>
			</view>
			<view v-for="(r,index) in outEntityList">
				<Expandlist :cellshows='cellshow' :arrcell='r' :celllist='celllist' :title='r.adjustNo'>
					<template #text>
						<p class='solts'><label class="solts_label"><label style='font-size: 24rpx;color: #999999;'>调出</label>￥</label><span class="solts_span" v-money>{{r.adjustAmt}}</span></p>
					</template>
				</Expandlist>
			</view>
		</view>
		
		
		<!-- 调入预算 -->
		<view class="formcard" id="add_three">
			<view class="bodtitle">
				<p><b>调入预算</b></p>
			</view>
			<view v-for="(r,index) in inEntityList">
				<Expandlist :cellshows='cellshow' :arrcell='r' :celllist='celllist1' :title='r.adjustNo'>
					<template #text>
						<p class='solts'><label class="solts_label"><label style='font-size: 24rpx;color: #999999;'>调出</label>￥</label><span class="solts_span" v-money>{{r.adjustAmt}}</span></p>
					</template>
				</Expandlist>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		components:{
		},
		data() {
			return {
				list1:[
					{name:'基本信息'},
					{name:'调出预算'},
					{name:'调入预算'},
				],
				rows:[],
				outEntityList:[],
				inEntityList:[],
				addlist: [{
						tit: '单据编号',
						val: 'adjustNo'
					},
					{
						tit: '申请人',
						val: 'applicantName'
					},
					{
						tit: '工号',
						val: 'applicant'
					},
					{
						tit: '科室',
						val: 'orgCode'
					},
					{
						tit: '主题',
						val: 'subject'
					},
					{
						tit: '详细说明',
						val: 'adjustReason'
					},
					{
						tit: '调整金额',
						val: 'adjustAmt'
					},
				],
				cellshow: true,
				celllist: [
					{
						tit: '预算年度',
						val: 'budgetYear'
					},
					{
						tit: '预算科室',
						val: 'subdeptNm'
					},
					{
						tit: '预算号',
						val: 'budgetNm'
					},
					{
						tit: '预算号名称',
						val: 'budgetNm'
					},
					{
						tit: '月度预算',
						val: 'initAmt',
						type:'number'
					},
					{
						tit: '调整月份',
						val: 'budgetMonth'
					},
					{
						tit: '可用金额',
						val: 'usableAmt',
						type:'number'
					},
					{
						tit: '调出金额',
						val: 'adjustAmt',
						type:'number'
					},
					{
						tit: '调出后可用金额',
						val: 'afterAdjustAmt',
						type:'number'
					},
				],
				celllist1: [
					{
						tit: '预算年度',
						val: 'budgetYear'
					},
					{
						tit: '预算科室',
						val: 'subdeptNm'
					},
					{
						tit: '预算号',
						val: 'budgetNm'
					},
					{
						tit: '预算号名称',
						val: 'budgetNm'
					},
					{
						tit: '月度预算',
						val: 'initAmt',
						type:'number'
					},
					{
						tit: '调整月份',
						val: 'budgetMonth'
					},
					{
						tit: '可用金额',
						val: 'usableAmt',
						type:'number'
					},
					{
						tit: '调入金额',
						val: 'adjustAmt',
						type:'number'
					},
					{
						tit: '调出后可用金额',
						val: 'afterAdjustAmt',
						type:'number'
					},
				],
				fileNo:[]
			}
		},
		onLoad() {
			 //获取流程页面的流程上下文[实用的流程信息从这里获取]
			  let billNo= window.parent.myvm.wfContext.BusinessKey;
			  this.fileNo = window.parent.myvm.wfContext.BusinessKey;
			  this.getlist(billNo)
		},
		mounted() {
			var that = this;
			window.myvm = that;
			window.$urlFormVue = that;
		},
		methods: {
			getlist(adjustNo){
				let _this = this
				let params = {
					adjustNo
				}
				_this.$lyRequest.get('/gateway/budget/mp/dbsap/budget/adjustm/queryBillInfo.do',
					params
				).then((result)=>{
					if(result.success){
						this.rows = result.data.rows
						this.outEntityList = result.data.row.outEntityList
						this.inEntityList = result.data.row.inEntityList
					}else{
						console.log(result.data.msg)
					}
				})
			},
			//审批和驳回-工作流点击"提交"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			rejectWorkflow(btnDef) {
				return "";
			},
			//作废-工作流点击"作废"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//content为作废意见
			invalidWorkflow(content) {
				return "";
			},
			//转办-工作流点击"确认转办"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//opinion:转办意见
			referredWorkflow(opinion) {
				return "";
			},
			//校验-工作流点击"提交"时触校验函数，返回:true校验通过，false校验不通过；
			//也可以返回具体的错误信息：空字符串，校验通过，返回具体错误信息校验不通过，同时弹出具体的错误信息。
			validateWorkflowForm(btnDef,callback) {
				callback("");
			},
			//提交单据
			sendWorkflow(btnDef, callback) {
				callback("");
			},
			checkbtn(item){ //切换tabs
				if(item.index ===0){
					this.commonApi.goAnchor('add_one')
				}else if(item.index === 1){
					this.commonApi.goAnchor('add_two')
				}else{
					this.commonApi.goAnchor('add_three')
				}
			},
		}
	}
</script>

<style  lang="scss" scoped>
	view {
		font-family: pf;
	}		
	.bottom_setup {
		width: 100%;
		height: 160rpx;
		background-color: white;
		margin-top: 20rpx;
		padding: 35rpx 0;
		box-sizing: border-box;
		box-shadow: 5px -10rpx 5px 0px rgba(225, 225, 225,.4),;
		.bottom_white1{
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: space-between;
				height: 100rpx;
				.custom-styles{
					padding: 20rpx 30rpx;
					width: 300rpx;
					height: 100rpx;
				}
				.custom-style{
					padding: 20rpx 30rpx;
					width: 300rpx;
					height: 100rpx;
					background-color: #007aff;
				}
			}
	}
</style>
